home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / gfx / 3d / irit50src.lha / irit5 / grapdrvs / wntdrvs.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-02-27  |  38.5 KB  |  1,056 lines

  1. /*****************************************************************************
  2. *   A Windows NT driver - framework.                         *
  3. *                                         *
  4. * Written by:  Gershon Elber                Ver 0.1, June 1993.  *
  5. *****************************************************************************/
  6.  
  7. #include <stdio.h>
  8. #include <windows.h>
  9. #include <process.h>
  10. #include "irit_sm.h"
  11. #include "genmat.h"
  12. #include "iritprsr.h"
  13. #include "allocate.h"
  14. #include "attribut.h"
  15. #include "ip_cnvrt.h"
  16. #include "cagd_lib.h"
  17. #include "symb_lib.h"
  18. #include "iritgrap.h"
  19. #include "irit_soc.h"
  20. #include "wntdrvs.h"
  21.  
  22. /* Interactive menu setup structure: */
  23. #define INTERACT_NUM_OF_STRINGS        3
  24. #define INTERACT_NUM_OF_SUB_WNDWS    15
  25. #define INTERACT_SUB_WINDOW_WIDTH  0.8         /* Relative to window size. */
  26. #define INTERACT_SUB_WINDOW_HEIGHT 0.04
  27.  
  28. typedef struct InteractString {
  29.     RealType X, Y;
  30.     int Color;
  31.     char *Str;
  32. } InteractString;
  33. typedef struct InteractSubWindow {
  34.     RealType X, Y;                       /* Center points. */
  35.     int Color;
  36.     IGGraphicEventType Event;
  37.     int TextInside; /* If TRUE, Str will be in window, otherwise left to it. */
  38.     char *Str;
  39. } InteractSubWindow;
  40. typedef struct InteractWindowStruct {     /* The interactive menu structures. */
  41.     /* Rotate, Translate, Scale strings: */
  42.     InteractString Strings[INTERACT_NUM_OF_STRINGS];
  43.     InteractSubWindow SubWindows[INTERACT_NUM_OF_SUB_WNDWS];
  44. } InteractWindowStruct;
  45.  
  46. /* Interactive mode menu set up structure is define below: */
  47. static InteractWindowStruct InteractMenu =
  48. {
  49.   {
  50.     { 0.5, 0.76, IG_IRIT_RED,   "Rotate" },
  51.     { 0.5, 0.56, IG_IRIT_GREEN, "Translate" },
  52.     { 0.5, 0.36, IG_IRIT_CYAN,  "Scale" },
  53.   },
  54.   {
  55.     { 0.5, 0.92, IG_IRIT_YELLOW, IG_EVENT_SCR_OBJ_TGL,    TRUE,  "Screen Coords." },
  56.     { 0.5, 0.84, IG_IRIT_BLUE,   IG_EVENT_PERS_ORTHO_TGL, TRUE,  "Perspective" },
  57.     { 0.5, 0.79, IG_IRIT_BLUE,   IG_EVENT_PERS_ORTHO_Z,   FALSE, "Z" },
  58.     { 0.5, 0.69, IG_IRIT_RED,    IG_EVENT_ROTATE_X,       FALSE, "X" },  /* Rot */
  59.     { 0.5, 0.64, IG_IRIT_RED,    IG_EVENT_ROTATE_Y,       FALSE, "Y" },
  60.     { 0.5, 0.59, IG_IRIT_RED,    IG_EVENT_ROTATE_Z,       FALSE, "Z" },
  61.     { 0.5, 0.49, IG_IRIT_GREEN,  IG_EVENT_TRANSLATE_X,    FALSE, "X" },/* Trans */
  62.     { 0.5, 0.44, IG_IRIT_GREEN,  IG_EVENT_TRANSLATE_Y,    FALSE, "Y" },
  63.     { 0.5, 0.39, IG_IRIT_GREEN,  IG_EVENT_TRANSLATE_Z,    FALSE, "Z" },
  64.     { 0.5, 0.29, IG_IRIT_CYAN,   IG_EVENT_SCALE,      FALSE, "" }, /* Scale */
  65.     { 0.5, 0.21, IG_IRIT_YELLOW, IG_EVENT_DEPTH_CUE,      TRUE,  "Depth Cue" },
  66.     { 0.5, 0.16, IG_IRIT_YELLOW, IG_EVENT_SAVE_MATRIX,    TRUE,  "Save Matrix" },
  67.     { 0.5, 0.12, IG_IRIT_YELLOW, IG_EVENT_PUSH_MATRIX,    TRUE,  "Push Matrix" },
  68.     { 0.5, 0.08, IG_IRIT_YELLOW, IG_EVENT_POP_MATRIX,     TRUE,  "Pop Matrix" },
  69.     { 0.5, 0.03, IG_IRIT_WHITE,  IG_EVENT_QUIT,              TRUE,  "Quit" },
  70.   }
  71. };
  72.  
  73. /* Colors to be used for viewed object (see also iritgrap.h):           */
  74. /* This colors are adjusted so as to give Windows NT better chance at      */
  75. /* selecting these colors as solid.                       */
  76. static short Colors[IG_MAX_COLOR + 1][3] =
  77. {
  78.     { 0,   0,   0   },  /* 0. BLACK */
  79.     { 0,   0,   255 },  /* 1. BLUE */
  80.     { 0,   255, 0   },  /* 2. GREEN */
  81.     { 0,   255, 255 },  /* 3. CYAN */
  82.     { 255, 0,   0   },  /* 4. RED */
  83.     { 255, 0,   255 },  /* 5. MAGENTA */
  84.     { 127, 127, 0   },  /* 6. BROWN */
  85.     { 127, 127, 127 },  /* 7. LIGHTGREY */
  86.     { 63,  63,  63  },  /* 8. DARKGRAY */
  87.     { 63,  63,  255 },  /* 9. LIGHTBLUE */
  88.     { 63,  255, 63  },  /* 10. LIGHTGREEN */
  89.     { 63,  255, 255 },  /* 11. LIGHTCYAN */
  90.     { 255, 63,  63  },  /* 12. LIGHTRED */
  91.     { 255, 63,  255 },  /* 13. LIGHTMAGENTA */
  92.     { 255, 255, 63  },  /* 14. YELLOW */
  93.     { 255, 255, 255 }   /* 15. WHITE */
  94. };
  95.  
  96. static int
  97.     CurrentXPosition = 0,
  98.     CurrentYPosition = 0;
  99. static unsigned int
  100.     TransWidth = DEFAULT_TRANS_WIDTH,
  101.     TransHeight = DEFAULT_TRANS_HEIGHT,
  102.     TransWidth2 = DEFAULT_TRANS_WIDTH / 2,
  103.     TransHeight2 = DEFAULT_TRANS_HEIGHT / 2;
  104. unsigned int
  105.     IGViewWidth = DEFAULT_VIEW_WIDTH,
  106.     IGViewHeight = DEFAULT_VIEW_HEIGHT,
  107.     IGViewWidth2 = DEFAULT_VIEW_WIDTH / 2,
  108.     IGViewHeight2 = DEFAULT_VIEW_HEIGHT / 2;
  109.  
  110. HBRUSH IGBackGroundBrush;
  111. COLORREF
  112.     IGBackGroundColor, IGCrntColorLowIntensity, IGCrntColorHighIntensity,
  113.     IGColorsLowIntensity[IG_MAX_COLOR + 1],
  114.     IGColorsHighIntensity[IG_MAX_COLOR + 1];
  115. HPEN
  116.     IGCurrenthPen = 0;
  117. HDC IGCurrenthDC = 0;
  118. HWND IGhWndView, IGhWndTrans;
  119. HMENU GlblStateMenu = 0;
  120.  
  121. static void GetArgCV(CHAR *Str, int *argc, CHAR ***argv);
  122. static void GetInputFromSocket(void *Data);
  123. static LONG APIENTRY WndProc(HWND hWndFrame,
  124.                  UINT wMsg,
  125.                  WPARAM wParam,
  126.                  LONG lParam);
  127. static LONG APIENTRY ViewWndProc(HWND hWndFrame,
  128.                  UINT wMsg,
  129.                  WPARAM wParam,
  130.                  LONG lParam);
  131. static LONG APIENTRY TransWndProc(HWND hWndFrame,
  132.                   UINT wMsg,
  133.                   WPARAM wParam,
  134.                   LONG lParam);
  135. static IGGraphicEventType GetGraphicEvent(RealType *ChangeFactor,
  136.                       int X,
  137.                       int Y);
  138. static void RedrawTransformationWindow(HWND hWnd);
  139. static void SetColorIndex2(int color, int width);
  140. static void DrawTextLocal(char *Str, int PosX, int PosY);
  141.  
  142. /*****************************************************************************
  143. * DESCRIPTION:                                                               *
  144. * Gets the command line into a form understandable by K&R definition.        *
  145. *                                                                            *
  146. * PARAMETERS:                                                                *
  147. *   Str:         Command line to decipher.                                   *
  148. *   argc, argv:  Command line, K&R style.                                    *
  149. *                                                                            *
  150. * RETURN VALUE:                                                              *
  151. *   void                                                                     *
  152. *****************************************************************************/
  153. static void GetArgCV(CHAR *Str, int *argc, CHAR ***argv)
  154. {
  155.     static CHAR CommandLine[ARGCV_LINE_LEN];
  156.     static CHAR *Argv[ARGCV_MAX_WORDS];
  157.     int Argc;
  158.     CHAR *p;
  159.  
  160.     strncpy(CommandLine, Str, ARGCV_LINE_LEN - 1);
  161.     CommandLine[ARGCV_LINE_LEN] = 0;
  162.  
  163.     for (Argc = 1, Argv[0] = "wntdrvs", p = strtok(CommandLine, " \t\n\r");
  164.          p != NULL && Argc < ARGCV_MAX_WORDS - 1;
  165.          p = strtok(NULL, " \t\n\r"))
  166.     Argv[Argc++] = p;
  167.  
  168.     Argv[Argc] = NULL;
  169.  
  170.     *argc = Argc;
  171.     *argv = Argv;
  172. }
  173.  
  174. /*****************************************************************************
  175. * DESCRIPTION:                                                               M
  176. * Main module of wntdrvs - Windows NT graphics driver of IRIT.                 M
  177. *                                                                            *
  178. * PARAMETERS:                                                                M
  179. *   hInst, hPrevInst, lpszLine, nShow: Command line and wierd Windows staff. M
  180. *                                                                            *
  181. * RETURN VALUE:                                                              M
  182. *   int:         Exit code.                                                  M
  183. *                                                                            *
  184. * KEYWORDS:                                                                  M
  185. *   WinMain                                                                  M
  186. *****************************************************************************/
  187. int PASCAL WinMain(HANDLE hInst, HANDLE hPrevInst, LPSTR lpszLine, int nShow)
  188. {
  189.     int argc;
  190.     char **argv;
  191.     HWND hWndFrame;
  192.     MSG msg;
  193.     int TransPrefPos[4], ViewPrefPos[4];
  194.  
  195.     GetArgCV(lpszLine, &argc, &argv);
  196.     IGConfigureGlobals("wntdrvs", argc, argv);
  197.  
  198.     IGBackGroundColor = RGB(IGGlblBackGroundColor[0],
  199.                     IGGlblBackGroundColor[1],
  200.                 IGGlblBackGroundColor[2]);
  201.     IGBackGroundBrush = CreateSolidBrush(IGBackGroundColor);
  202.  
  203.     if (!hPrevInst) {
  204.     WNDCLASS wndClass;
  205.     int Registered = TRUE;
  206.  
  207.     /* Set up common defaults. */
  208.         wndClass.style         = CS_HREDRAW | CS_VREDRAW;
  209.     wndClass.cbClsExtra    = 0;
  210.     wndClass.cbWndExtra    = 0;
  211.     wndClass.hCursor       = LoadCursor(NULL, IDC_ARROW);
  212.     wndClass.hInstance     = hInst;
  213.  
  214.     /* Register top level main window. */
  215.     wndClass.lpfnWndProc   = WndProc;
  216.     wndClass.hIcon         = LoadIcon(hInst, APP_CLASS);
  217.     wndClass.hbrBackground = GetStockObject(BLACK_BRUSH);
  218.     wndClass.lpszMenuName  = APP_CLASS;
  219.     wndClass.lpszClassName = APP_CLASS;
  220.     if (!RegisterClass(&wndClass))
  221.         return FALSE;
  222.  
  223.     /* Register viewing window. */
  224.     wndClass.lpfnWndProc   = ViewWndProc;
  225.     wndClass.hIcon         = NULL;
  226.     wndClass.hbrBackground = CreateSolidBrush(IGBackGroundColor);
  227.     wndClass.lpszClassName = APP_VIEW_CLASS;
  228.     if (!RegisterClass(&wndClass))
  229.         return FALSE;
  230.  
  231.     /* Register transformation window. */
  232.     wndClass.lpfnWndProc   = TransWndProc;
  233.     wndClass.lpszClassName = APP_TRANS_CLASS;
  234.     if (!RegisterClass(&wndClass))
  235.         return FALSE;
  236.     }
  237.  
  238.     if (sscanf(IGGlblTransPrefPos, "%d,%d,%d,%d",
  239.            &TransPrefPos[0], &TransPrefPos[1],
  240.            &TransPrefPos[2], &TransPrefPos[3]) == 4 &&
  241.     sscanf(IGGlblViewPrefPos, "%d,%d,%d,%d",
  242.            &ViewPrefPos[0], &ViewPrefPos[1],
  243.            &ViewPrefPos[2], &ViewPrefPos[3]) == 4) {
  244.     hWndFrame = CreateWindow(APP_CLASS,
  245.                  APP_TITLE,
  246.                  WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
  247.                  ViewPrefPos[0],
  248.                  ViewPrefPos[2],
  249.                  ViewPrefPos[1] - ViewPrefPos[0] +
  250.                      TransPrefPos[1] - TransPrefPos[0],
  251.                  MAX(ViewPrefPos[3] - ViewPrefPos[2],
  252.                      TransPrefPos[3] - TransPrefPos[2]),
  253.                  NULL,
  254.                  NULL,
  255.                  hInst,
  256.                  NULL);
  257.     }
  258.     else if (sscanf(IGGlblTransPrefPos, "%d,%d,%d,%d",
  259.             &TransPrefPos[0], &TransPrefPos[1],
  260.             &TransPrefPos[2], &TransPrefPos[3]) == 2 &&
  261.          sscanf(IGGlblViewPrefPos, "%d,%d,%d,%d",
  262.                 &ViewPrefPos[0], &ViewPrefPos[1],
  263.                 &ViewPrefPos[2], &ViewPrefPos[3]) == 2) {
  264.     hWndFrame = CreateWindow(APP_CLASS,
  265.                  APP_TITLE,
  266.                  WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
  267.                  CW_USEDEFAULT,
  268.                  CW_USEDEFAULT,
  269.                  ViewPrefPos[0],
  270.                  ViewPrefPos[2],
  271.                  NULL,
  272.                  NULL,
  273.                  hInst,
  274.                  NULL);
  275.     }
  276.     else if (sscanf(IGGlblTransPrefPos, "%d,%d,%d,%d",
  277.             &TransPrefPos[0], &TransPrefPos[1],
  278.             &TransPrefPos[2], &TransPrefPos[3]) == 4 &&
  279.          sscanf(IGGlblViewPrefPos, "%d,%d,%d,%d",
  280.                 &ViewPrefPos[0], &ViewPrefPos[1],
  281.                 &ViewPrefPos[2], &ViewPrefPos[3]) == 4) {
  282.     }
  283.     else 
  284.         hWndFrame = CreateWindow(APP_CLASS,
  285.                  APP_TITLE,
  286.                  WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN,
  287.                  CW_USEDEFAULT,
  288.                  CW_USEDEFAULT,
  289.                  CW_USEDEFAULT,
  290.                  CW_USEDEFAULT,            
  291.                  NULL,
  292.                  NULL,
  293.                  hInst,
  294.                  NULL);
  295.  
  296.     msg.wParam = 1;
  297.     if (hWndFrame) {
  298.     HDC hDC;
  299.  
  300.     if (hDC = GetDC(hWndFrame)) {
  301.         int i;
  302.  
  303.         for (i = 0; i <= IG_MAX_COLOR; i++) {
  304.             IGColorsHighIntensity[i] = GetNearestColor(hDC,
  305.                 RGB(Colors[i][0], Colors[i][1], Colors[i][2]));
  306.             IGColorsLowIntensity[i] = GetNearestColor(hDC,
  307.             RGB(Colors[i][0] / 2, Colors[i][1] / 2, Colors[i][2] / 2));
  308.         }
  309.         ReleaseDC(hWndFrame, hDC);
  310.     }
  311.  
  312.         ShowWindow(hWndFrame, nShow);
  313.         UpdateWindow(hWndFrame);
  314.  
  315.     /* Set up the input socket as a secondary threat, if we are to wait  */
  316.     /* for input from input socket.                         */
  317.     if (!IGGlblStandAlone)
  318.         _beginthread(GetInputFromSocket, 0, NULL);
  319.  
  320.         while (GetMessage(&msg, NULL, 0, 0)) {
  321.             TranslateMessage(&msg);
  322.             DispatchMessage(&msg);
  323.         }
  324.     }
  325.  
  326.     UnregisterClass(APP_CLASS, hInst);
  327.     UnregisterClass(APP_VIEW_CLASS, hInst);
  328.     UnregisterClass(APP_TRANS_CLASS, hInst);
  329.  
  330.     return msg.wParam;
  331. }
  332.  
  333. /*****************************************************************************
  334. * DESCRIPTION:                                                               M
  335. * Optionally construct a state pop up menu for the driver, if has one.       M
  336. *                                                                            *
  337. * PARAMETERS:                                                                M
  338. *   None                                                                     *
  339. *                                                                            *
  340. * RETURN VALUE:                                                              M
  341. *   void                                                                     M
  342. *                                                                            *
  343. * KEYWORDS:                                                                  M
  344. *   IGCreateStateMenu                                                        M
  345. *****************************************************************************/
  346. void IGCreateStateMenu(void)
  347. {
  348.     if (GlblStateMenu) 
  349.     DestroyMenu(GlblStateMenu);
  350.  
  351.     GlblStateMenu = CreatePopupMenu();
  352.  
  353.     AppendMenu(GlblStateMenu, MF_STRING, IG_STATE_MORE_SENSITIVE,
  354.            "More Sensitive");
  355.     AppendMenu(GlblStateMenu, MF_STRING, IG_STATE_LESS_SENSITIVE,
  356.            "Less Sensitive");
  357.     AppendMenu(GlblStateMenu,
  358.            SET_MENU_FLAGS(IGGlblTransformMode == IG_TRANS_SCREEN),
  359.            IG_STATE_SCR_OBJ_TGL, "Screen Coords.");
  360.     AppendMenu(GlblStateMenu,
  361.            SET_MENU_FLAGS(IGGlblViewMode == IG_VIEW_PERSPECTIVE),
  362.            IG_STATE_PERS_ORTHO_TGL, "Perspective");
  363.     AppendMenu(GlblStateMenu, SET_MENU_FLAGS(IGGlblDepthCue),
  364.            IG_STATE_DEPTH_CUE, "Depth Cue");
  365.     AppendMenu(GlblStateMenu, SET_MENU_FLAGS(IGGlblDoDoubleBuffer),
  366.            IG_STATE_DOUBLE_BUFFER, "DoubleBuffer");
  367.     AppendMenu(GlblStateMenu, SET_MENU_FLAGS(IGGlblDrawSolid),
  368.            IG_STATE_DRAW_SOLID, "DrawSolid");
  369.     AppendMenu(GlblStateMenu, SET_MENU_FLAGS(IGGlblBackFaceCull),
  370.            IG_STATE_BACK_FACE_CULL, "Back Face Cull");
  371.     AppendMenu(GlblStateMenu, SET_MENU_FLAGS(IGGlblDrawInternal),
  372.            IG_STATE_DRAW_INTERNAL, "Draw Internal Edges");
  373.     AppendMenu(GlblStateMenu, SET_MENU_FLAGS(IGGlblDrawVNormal),
  374.            IG_STATE_DRAW_VNORMAL, "Draw Vrtx Normals");
  375.     AppendMenu(GlblStateMenu, SET_MENU_FLAGS(IGGlblDrawPNormal),
  376.            IG_STATE_DRAW_PNORMAL, "Draw Poly Normals");
  377.     AppendMenu(GlblStateMenu, SET_MENU_FLAGS(IGGlblDrawSurfaceMesh),
  378.            IG_STATE_DRAW_SRF_MESH, "Draw Surface Mesh");
  379.     AppendMenu(GlblStateMenu, SET_MENU_FLAGS(IGGlblDrawSurfacePoly),
  380.            IG_STATE_DRAW_SRF_POLY, "Surface Polygons");
  381.     AppendMenu(GlblStateMenu, MF_STRING, IG_STATE_FOUR_PER_FLAT,
  382.            IGGlblFourPerFlat ? "Four Per Flat" : "Two Per Flat");
  383.     AppendMenu(GlblStateMenu, MF_STRING, IG_STATE_MORE_ISOLINES,
  384.            "More Isolines");
  385.     AppendMenu(GlblStateMenu, MF_STRING, IG_STATE_LESS_ISOLINES,
  386.            "Less Isolines");
  387.     AppendMenu(GlblStateMenu, MF_STRING, IG_STATE_FINER_APPROX,
  388.            "Finer approximation");
  389.     AppendMenu(GlblStateMenu, MF_STRING, IG_STATE_COARSER_APPROX,
  390.            "Coarser approximation");
  391.     AppendMenu(GlblStateMenu, MF_STRING, IG_STATE_LONGER_VECTORS,
  392.            "Longer Vectors");
  393.     AppendMenu(GlblStateMenu, MF_STRING, IG_STATE_SHORTER_VECTORS,
  394.            "Shorter Vectors");
  395.     AppendMenu(GlblStateMenu, MF_STRING, IG_STATE_WIDER_LINES,
  396.            "Wider Lines");
  397.     AppendMenu(GlblStateMenu, MF_STRING, IG_STATE_NARROW_LINES,
  398.            "Thinner Lines");
  399.     AppendMenu(GlblStateMenu, MF_STRING, IG_STATE_CLEAR_VIEW,
  400.            "Clear View Area");
  401. }
  402.  
  403. /*****************************************************************************
  404. * DESCRIPTION:                                                               *
  405. * A secondary thread that waits for input from socket.                 *
  406. *                                                                            *
  407. * PARAMETERS:                                                                *
  408. *   Data:      Not used.                                                     *
  409. *                                                                            *
  410. * RETURN VALUE:                                                              *
  411. *   void                                                                     *
  412. *****************************************************************************/
  413. static void GetInputFromSocket(void *Data)
  414. {
  415.     while (TRUE) {
  416.     if (IGReadObjectsFromSocket(IGGlblViewMode, &IGGlblDisplayList))
  417.         InvalidateRect(IGhWndView, NULL, FALSE);
  418.     }
  419. }
  420.  
  421. /*****************************************************************************
  422. * DESCRIPTION:                                                               *
  423. * Top level window call back drawing function.                     *
  424. *                                         *
  425. * PARAMETERS:                                                                *
  426. *   hWndFrame:       A handle on the window.                                 *
  427. *   wMsg:            Type of event to handle.                                *
  428. *   mParam, lParam:  Parameters of event.                                    *
  429. *                                                                            *
  430. * RETURN VALUE:                                                              *
  431. *   MRESULT:  Event state code.                                              *
  432. *****************************************************************************/
  433. static LONG APIENTRY WndProc(HWND hWndFrame,
  434.                  UINT wMsg,
  435.                  WPARAM wParam,
  436.                  LONG lParam)
  437. {
  438.     static RECT rect;
  439.     HDC hDC;
  440.     TEXTMETRIC tm;
  441.     int Refresh;
  442.  
  443.     switch (wMsg) {
  444.         case WM_CREATE:
  445.             if (hDC = GetDC(hWndFrame)) {
  446.         SelectObject(hDC, GetStockObject(SYSTEM_FIXED_FONT));
  447.         GetTextMetrics(hDC, &tm);
  448.         ReleaseDC(hWndFrame, hDC);
  449.         }
  450.  
  451.         GetClientRect(hWndFrame, &rect);
  452.  
  453.         IGhWndView = CreateWindow(APP_VIEW_CLASS,
  454.                       "v",
  455.                       WS_CHILD | WS_BORDER | WS_VISIBLE |
  456.                       WS_CLIPSIBLINGS | WS_CLIPCHILDREN,
  457.                       0,
  458.                       0,
  459.                       IGViewWidth = (rect.right * 3) / 4 - 2,
  460.                       IGViewHeight = rect.bottom,
  461.                       hWndFrame,
  462.                       0,
  463.                       ((LPCREATESTRUCT) lParam)->hInstance,
  464.                       NULL);
  465.         IGViewWidth2 = IGViewWidth / 2;
  466.         IGViewHeight2 = IGViewHeight / 2;
  467.  
  468.         IGhWndTrans = CreateWindow(APP_TRANS_CLASS,
  469.                        "t",
  470.                        WS_CHILD | WS_BORDER | WS_VISIBLE,
  471.                        (rect.right * 3) / 4,
  472.                        0,
  473.                        TransWidth = rect.right / 4,
  474.                        TransHeight = rect.bottom,
  475.                        hWndFrame,
  476.                        0,
  477.                        ((LPCREATESTRUCT) lParam)->hInstance,
  478.                        NULL);
  479.         TransWidth2 = TransWidth / 2;
  480.         TransHeight2 = TransHeight / 2;
  481.          return 0;
  482.  
  483.     case WM_SIZE:
  484.         rect.left   = 0;
  485.         rect.top    = 0;
  486.         rect.right  = LOWORD(lParam);
  487.         rect.bottom = HIWORD(lParam);
  488.  
  489.         SetWindowPos(IGhWndView,
  490.              HWND_TOP,
  491.              0,
  492.              0,
  493.              IGViewWidth = (rect.right * 3) / 4 - 2,
  494.              IGViewHeight = rect.bottom,
  495.              0);
  496.         IGViewWidth2 = IGViewWidth / 2;
  497.         IGViewHeight2 = IGViewHeight / 2;
  498.  
  499.         SetWindowPos(IGhWndTrans,
  500.              HWND_TOP,
  501.              (rect.right * 3) / 4,
  502.              0,
  503.              TransWidth = rect.right / 4 - 1,
  504.              TransHeight = rect.bottom - 1,
  505.              0);
  506.         TransWidth2 = TransWidth / 2;
  507.         TransHeight2 = TransHeight / 2;
  508.         return 0;
  509.  
  510.     case WM_QUERYNEWPALETTE:
  511.     case WM_PALETTECHANGED:
  512.         if (wParam != (WPARAM) hWndFrame)
  513.         SendMessage(IGhWndView, wMsg, 0, 0L);
  514.         return 0;
  515.  
  516.     case WM_DESTROY:
  517.         PostQuitMessage(0);
  518.         return 0;
  519.  
  520.         case WM_COMMAND:
  521.         Refresh = FALSE;
  522.             switch (LOWORD(wParam)) {
  523.         case IDM_FILE_SAVE:
  524.             IGSaveCurrentMat(IGGlblViewMode, NULL);
  525.             break;
  526.         case IDM_FILE_SAVE_AS:
  527.             {
  528.             OPENFILENAME ofn;
  529.             char FileName[LINE_LEN_LONG];
  530.  
  531.             FileName[0] = 0;
  532.  
  533.             memset(&ofn, 0, sizeof(OPENFILENAME));
  534.             ofn.lStructSize = sizeof(OPENFILENAME);
  535.             ofn.hwndOwner = hWndFrame;
  536.             ofn.lpstrFile = FileName;
  537.             ofn.nMaxFile = LINE_LEN_LONG;
  538.             ofn.lpstrTitle = "Save View Matrix";
  539.             ofn.Flags = OFN_OVERWRITEPROMPT;
  540.  
  541.                 if (GetOpenFileName(&ofn) && strlen(FileName) > 0)
  542.             IGSaveCurrentMat(IGGlblViewMode, FileName);
  543.             }
  544.             break;
  545.         case IDM_FILE_QUIT:
  546.             exit(0);
  547.             break;
  548.  
  549.         case IDM_MOUSE_MORE:
  550.             IGHandleState(IG_STATE_MORE_SENSITIVE, TRUE);
  551.             break;
  552.         case IDM_MOUSE_LESS:
  553.             IGHandleState(IG_STATE_LESS_SENSITIVE, TRUE);
  554.             break;
  555.  
  556.         case IDM_STATE_MORE_ISO:
  557.             Refresh = IGHandleState(IG_STATE_MORE_ISOLINES, TRUE);
  558.             break;
  559.         case IDM_STATE_LESS_ISO:
  560.             Refresh = IGHandleState(IG_STATE_LESS_ISOLINES, TRUE);
  561.             break;
  562.         case IDM_STATE_FINER_APPROX:
  563.             Refresh = IGHandleState(IG_STATE_FINER_APPROX, TRUE);
  564.             break;
  565.         case IDM_STATE_COARSER_APPROX:
  566.             Refresh = IGHandleState(IG_STATE_COARSER_APPROX, TRUE);
  567.             break;
  568.         case IDM_STATE_SHORTER_VEC:
  569.             Refresh = IGHandleState(IG_STATE_SHORTER_VECTORS, TRUE);
  570.             break;
  571.         case IDM_STATE_LONGER_VEC:
  572.             Refresh = IGHandleState(IG_STATE_LONGER_VECTORS, TRUE);
  573.             break;
  574.         case IDM_STATE_WIDE_LINES:
  575.             Refresh = IGHandleState(IG_STATE_WIDER_LINES, TRUE);
  576.             break;
  577.         case IDM_STATE_THIN_LINES:
  578.             Refresh = IGHandleState(IG_STATE_NARROW_LINES, TRUE);
  579.             break;
  580.  
  581.         case IDM_TGLS_SCREEN:
  582.             IGHandleState(IG_STATE_SCR_OBJ_TGL, TRUE);
  583.             break;
  584.         case IDM_TGLS_PERSP:
  585.             Refresh = IGHandleState(IG_STATE_PERS_ORTHO_TGL, TRUE);
  586.             break;
  587.         case IDM_TGLS_DEPTH_CUE:
  588.             Refresh = IGHandleState(IG_STATE_DEPTH_CUE, TRUE);
  589.             break;
  590.         case IDM_TGLS_DOUBLE_BUFFER:
  591.             Refresh = IGHandleState(IG_STATE_DOUBLE_BUFFER, TRUE);
  592.             break;
  593.         case IDM_TGLS_DRAW_SOLID:
  594.             Refresh = IGHandleState(IG_STATE_DRAW_SOLID, TRUE);
  595.             break;
  596.         case IDM_TGLS_INTERNAL:
  597.             Refresh = IGHandleState(IG_STATE_DRAW_INTERNAL, TRUE);
  598.             break;
  599.         case IDM_TGLS_VRTX_NRML:
  600.             Refresh = IGHandleState(IG_STATE_DRAW_VNORMAL, TRUE);
  601.             break;
  602.         case IDM_TGLS_POLY_NRML:
  603.             Refresh = IGHandleState(IG_STATE_DRAW_PNORMAL, TRUE);
  604.             break;
  605.         case IDM_TGLS_CTL_MESH:
  606.             Refresh = IGHandleState(IG_STATE_DRAW_SRF_MESH, TRUE);
  607.             break;
  608.         case IDM_TGLS_SRF_POLYS:
  609.             Refresh = IGHandleState(IG_STATE_DRAW_SRF_POLY, TRUE);
  610.             break;
  611.         case IDM_TGLS_4_PER_FLAT:
  612.             Refresh = IGHandleState(IG_STATE_FOUR_PER_FLAT, TRUE);
  613.             break;
  614.  
  615.         case IDM_VIEW_FRONT:
  616.             Refresh = IGHandleState(IG_STATE_VIEW_FRONT, TRUE);
  617.             break;
  618.         case IDM_VIEW_SIDE:
  619.             Refresh = IGHandleState(IG_STATE_VIEW_SIDE, TRUE);
  620.             break;
  621.         case IDM_VIEW_TOP:
  622.             Refresh = IGHandleState(IG_STATE_VIEW_TOP, TRUE);
  623.             break;
  624.         case IDM_VIEW_ISOMETRY:
  625.             Refresh = IGHandleState(IG_STATE_VIEW_ISOMETRY, TRUE);
  626.             break;
  627.             }
  628.         if (Refresh)
  629.         InvalidateRect(IGhWndView, NULL, FALSE);
  630.             break;
  631.  
  632.         default:
  633.         return DefWindowProc(hWndFrame, wMsg, wParam, lParam);
  634.     }
  635.     return 0;
  636. }
  637.  
  638. /*****************************************************************************
  639. * DESCRIPTION:                                                               *
  640. * View window call back drawing function.                     *
  641. *                                         *
  642. * PARAMETERS:                                                                *
  643. *   hWndFrame:       A handle on the window.                                 *
  644. *   wMsg:            Type of event to handle                                 *
  645. *   mParam, lParam:  Parameters of event                                     *
  646. *                                                                            *
  647. * RETURN VALUE:                                                              *
  648. *   MRESULT:  Event state code.                                              *
  649. *****************************************************************************/
  650. static LONG APIENTRY ViewWndProc(HWND hWndFrame,
  651.                  UINT wMsg,
  652.                  WPARAM wParam,
  653.                  LONG lParam)
  654. {
  655.     switch (wMsg) {
  656.     case WM_CREATE:
  657.     case WM_PAINT:
  658.     case WM_QUERYNEWPALETTE:
  659.     case WM_PALETTECHANGED:
  660.         return RedrawViewWindow(hWndFrame, wMsg, wParam);
  661.  
  662.     case WM_DESTROY:
  663.         PostQuitMessage(0);
  664.         return 0;
  665.  
  666.     case WM_LBUTTONDOWN:
  667.     case WM_RBUTTONDOWN:
  668.         IGGlblAbortKeyPressed = TRUE;
  669.         break;
  670.  
  671.     default:
  672.         return DefWindowProc(hWndFrame, wMsg, wParam, lParam);
  673.     }
  674.     return 0;
  675. }
  676.  
  677. /*****************************************************************************
  678. * DESCRIPTION:                                                               *
  679. * Trans window call back drawing function.                     *
  680. *                                         *
  681. * PARAMETERS:                                                                *
  682. *   hWndFrame:       A handle on the window.                                 *
  683. *   wMsg:            Type of event to handle                                 *
  684. *   mParam, lParam:  Parameters of event                                     *
  685. *                                                                            *
  686. * RETURN VALUE:                                                              *
  687. *   MRESULT:  Event state code.                                              *
  688. *****************************************************************************/
  689. static LONG APIENTRY TransWndProc(HWND hWndFrame,
  690.                   UINT wMsg,
  691.                   WPARAM wParam,
  692.                   LONG lParam)
  693. {
  694.     static IGGraphicEventType
  695.     LastEvent = IG_EVENT_NONE;
  696.     static BOOL
  697.     bLeftBtnDown = FALSE;
  698.     static int
  699.     iMouseX = 0,
  700.     iMouseY = 0;
  701.     int iNewMouseX, iNewMouseY;
  702.     IGGraphicEventType Event;
  703.     RealType ChangeFactor;
  704.     POINT Point;
  705.  
  706.     switch (wMsg) {
  707.     case WM_PAINT:
  708.         RedrawTransformationWindow(hWndFrame);
  709.         return 0;
  710.  
  711.     case WM_RBUTTONDOWN:
  712.         if (!GlblStateMenu)
  713.         IGCreateStateMenu();
  714.  
  715.         Point.x = LOWORD(lParam);
  716.         Point.y = HIWORD(lParam);
  717.         ClientToScreen(hWndFrame, &Point);
  718.  
  719.         /* Activate the pop up menu. Events goes to WM_COMMAND here. */
  720.         TrackPopupMenu(GlblStateMenu,
  721.                TPM_CENTERALIGN | TPM_RIGHTBUTTON,
  722.                Point.x, Point.y, 0, hWndFrame, NULL);
  723.         return 0;
  724.  
  725.     case WM_LBUTTONDOWN:
  726.         /* Save fact that button is pressed. Might be a drag operation.*/
  727.         bLeftBtnDown = TRUE;
  728.         iMouseX = LOWORD(lParam);
  729.         iMouseY = HIWORD(lParam);
  730.  
  731.         if ((Event = GetGraphicEvent(&ChangeFactor,
  732.                      iMouseX, iMouseY)) != IG_EVENT_NONE) {
  733.         if (Event == IG_EVENT_QUIT) {
  734.             exit(0);           /* Not the nicest ways to quit. */
  735.         }
  736.         else {
  737.             if (IGProcessEvent(Event,
  738.                        ChangeFactor * IGGlblChangeFactor))
  739.                 InvalidateRect(IGhWndView, NULL, FALSE);
  740.  
  741.             /* Save the event in case drag operation is performed. */
  742.             LastEvent = Event;
  743.         }
  744.         }
  745.         return 0;
  746.  
  747.     case WM_LBUTTONUP:
  748.         /* Done with mouse click or drag operation. */
  749.         bLeftBtnDown = FALSE;
  750.         return 0;
  751.  
  752.     case WM_MOUSEMOVE:
  753.         if (bLeftBtnDown && IG_IS_DRAG_EVENT(LastEvent)) {
  754.         iNewMouseX = LOWORD(lParam);
  755.         iNewMouseY = HIWORD(lParam);
  756.         ChangeFactor = (iNewMouseX - iMouseX) /
  757.                              ((RealType) TransWidth);
  758.         iMouseX = iNewMouseX;
  759.         if (IGProcessEvent(LastEvent,
  760.                    ChangeFactor * IGGlblChangeFactor))
  761.             InvalidateRect(IGhWndView, NULL, FALSE);
  762.         }
  763.         return 0;
  764.  
  765.     case WM_DESTROY:
  766.         PostQuitMessage(0);
  767.         return 0;
  768.  
  769.     case WM_COMMAND:
  770.         /* Comamnds from the popup menu. */
  771.         if (IGHandleState(wParam, TRUE))
  772.         InvalidateRect(IGhWndView, NULL, FALSE);
  773.         return 0;
  774.  
  775.     default:
  776.         return DefWindowProc(hWndFrame, wMsg, wParam, lParam);
  777.     }
  778.     return 0;
  779. }
  780.  
  781. /*****************************************************************************
  782. * DESCRIPTION:                                                               *
  783. * Handles input events                                                       *
  784. *                                                                            *
  785. * PARAMETERS:                                                                *
  786. *   ChangeFactor:        A continuous numeric value between -1 and 1. This   *
  787. *             value will be used to set amount of event such as   *
  788. *             rotation or translation.                 *
  789. *   X, Y:         Location of mouse event.                 *
  790. *                                                                            *
  791. * RETURN VALUE:                                                              *
  792. *   IGGraphicEventType:  Type of new event.                                  *
  793. *****************************************************************************/
  794. static IGGraphicEventType GetGraphicEvent(RealType *ChangeFactor, int X, int Y)
  795. {
  796.     int i;
  797.     IGGraphicEventType
  798.     RetVal = IG_EVENT_NONE;
  799.     RealType XPos, YPos;
  800.  
  801.     XPos = ((RealType) X) / TransWidth;
  802.     YPos = 1.0 - ((RealType) Y) / TransHeight;
  803.  
  804.     /* Make sure we are in bound in the X direction. */
  805.     if (XPos < (1.0 - INTERACT_SUB_WINDOW_WIDTH) / 2.0 ||
  806.         XPos > 1.0 - (1.0 - INTERACT_SUB_WINDOW_WIDTH) / 2.0)
  807.     return IG_EVENT_NONE;
  808.  
  809.     /* Now search the sub window the event occured in. */
  810.     for (i = 0; i < INTERACT_NUM_OF_SUB_WNDWS; i++) {
  811.         if (InteractMenu.SubWindows[i].Y <= YPos &&
  812.         InteractMenu.SubWindows[i].Y + INTERACT_SUB_WINDOW_HEIGHT >=
  813.                                       YPos) {
  814.         RetVal = InteractMenu.SubWindows[i].Event;
  815.         break;
  816.     }
  817.     }
  818.  
  819.     /* Take care of special cases in which the window should be updated. */
  820.     switch (RetVal) {
  821.     case IG_EVENT_SCR_OBJ_TGL:
  822.         IGGlblTransformMode = IGGlblTransformMode == IG_TRANS_OBJECT ?
  823.                              IG_TRANS_SCREEN :
  824.                              IG_TRANS_OBJECT;
  825.         InvalidateRect(IGhWndTrans, NULL, TRUE);
  826.         IGCreateStateMenu();
  827.         break;
  828.     case IG_EVENT_PERS_ORTHO_TGL:
  829.         IGGlblViewMode = IGGlblViewMode == IG_VIEW_PERSPECTIVE ?
  830.                            IG_VIEW_ORTHOGRAPHIC :
  831.                            IG_VIEW_PERSPECTIVE;
  832.         InvalidateRect(IGhWndTrans, NULL, TRUE);
  833.         IGCreateStateMenu();
  834.         break;
  835.     case IG_EVENT_DEPTH_CUE:
  836.         IGGlblDepthCue = !IGGlblDepthCue;
  837.         InvalidateRect(IGhWndTrans, NULL, TRUE);
  838.         IGCreateStateMenu();
  839.         break;
  840.     }
  841.  
  842.     *ChangeFactor = (((RealType) X) - TransWidth2) / TransWidth2;
  843.  
  844.     return RetVal;
  845. }
  846.  
  847. /*****************************************************************************
  848. * DESCRIPTION:                                                               M
  849. * Handles the events of the pop up window.                                   M
  850. *                                                                            *
  851. * PARAMETERS:                                                                M
  852. *   State:      Event to handle.                                             M
  853. *   Refresh:    Do we need to refresh the screen according to what we know   M
  854. *        on entry.                             M
  855. *                                                                            *
  856. * RETURN VALUE:                                                              M
  857. *   int:        TRUE, if we need to refresh the screen.                      M
  858. *                                                                            *
  859. * KEYWORDS:                                                                  M
  860. *   IGHandleState                                                            M
  861. *****************************************************************************/
  862. int IGHandleState(int State, int Refresh)
  863. {
  864.     int UpdateView = TRUE;
  865.  
  866.     switch (State) {
  867.     case IG_STATE_DRAW_SOLID:
  868.         IGGlblDrawSolid = !IGGlblDrawSolid;
  869.         /* And disable the depth cueing. */
  870.         IGGlblDepthCue = TRUE; 
  871.     case IG_STATE_DEPTH_CUE:
  872.         IGGlblDepthCue = !IGGlblDepthCue;
  873.         InvalidateRect(IGhWndTrans, NULL, TRUE);
  874.         break;
  875.     case IG_STATE_DOUBLE_BUFFER:
  876.         IGGlblDoDoubleBuffer = !IGGlblDoDoubleBuffer;
  877.         break;
  878.         case IG_STATE_SCR_OBJ_TGL:
  879.     case IG_STATE_PERS_ORTHO_TGL:
  880.         InvalidateRect(IGhWndTrans, NULL, TRUE);
  881.     default:
  882.         UpdateView = IGDefaultStateHandler(State, Refresh);
  883.         break;
  884.     }
  885.  
  886.     IGCreateStateMenu();
  887.  
  888.     return UpdateView;
  889. }
  890.  
  891. /*****************************************************************************
  892. * DESCRIPTION:                                                               *
  893. * Redraws the transformation window.                         *
  894. *                                                                            *
  895. * PARAMETERS:                                                                *
  896. *   hwnd:       A handle on the window.                                      *
  897. *                                                                            *
  898. * RETURN VALUE:                                                              *
  899. *   void                                                                     *
  900. *****************************************************************************/
  901. static void RedrawTransformationWindow(HWND hWnd)
  902. {
  903.     int i;
  904.     long SubTransPosX, SubTransPosY, SubTransWidth, SubTransHeight;
  905.     RECT rect;
  906.     PAINTSTRUCT ps;
  907.  
  908.     /* Make sure the menu is consistent with internatal data. */
  909.     InteractMenu.SubWindows[0].Str =
  910.     IGGlblTransformMode == IG_TRANS_OBJECT ? "Object Coords."
  911.                            : "Screen Coords.";
  912.     InteractMenu.SubWindows[1].Str =
  913.     IGGlblViewMode == IG_VIEW_PERSPECTIVE ? "Perspective" : "Orthographic";
  914.     InteractMenu.SubWindows[10].Str =
  915.     IGGlblDepthCue ? "Depth Cue" : "No Depth Cue";
  916.  
  917.     SubTransWidth = (int) (TransWidth * INTERACT_SUB_WINDOW_WIDTH);
  918.     SubTransHeight = (int) (TransHeight * INTERACT_SUB_WINDOW_HEIGHT);
  919.     SubTransPosX = (TransWidth - SubTransWidth) / 2;
  920.  
  921.     if (IGCurrenthDC = BeginPaint(hWnd, &ps)) {
  922.     GetClientRect(hWnd, &rect);
  923.     FillRect(IGCurrenthDC, &rect, IGBackGroundBrush);
  924.  
  925.     SetBkMode(IGCurrenthDC, TRANSPARENT);
  926.     SetTextAlign(IGCurrenthDC, TA_CENTER | VTA_CENTER);
  927.  
  928.     for (i = 0; i < INTERACT_NUM_OF_SUB_WNDWS; i++) {
  929.         SetColorIndex2(InteractMenu.SubWindows[i].Color, 2);
  930.         SetTextColor(IGCurrenthDC, IGCrntColorHighIntensity);
  931.  
  932.         SubTransPosY = (int) (TransHeight *
  933.                     (1.0 - InteractMenu.SubWindows[i].Y));
  934.  
  935.         MoveToEx(IGCurrenthDC, SubTransPosX, SubTransPosY, NULL);
  936.         LineTo(IGCurrenthDC, SubTransPosX + SubTransWidth, SubTransPosY);
  937.         LineTo(IGCurrenthDC,
  938.            SubTransPosX + SubTransWidth, SubTransPosY - SubTransHeight);
  939.         LineTo(IGCurrenthDC, SubTransPosX, SubTransPosY - SubTransHeight);
  940.         LineTo(IGCurrenthDC, SubTransPosX, SubTransPosY);
  941.         if (InteractMenu.SubWindows[i].TextInside) {
  942.             DrawTextLocal(InteractMenu.SubWindows[i].Str,
  943.                   TransWidth / 2,
  944.                   SubTransPosY - SubTransHeight);
  945.         }
  946.         else {
  947.         DrawTextLocal(InteractMenu.SubWindows[i].Str,
  948.                   (TransWidth - SubTransWidth) / 3,
  949.                   SubTransPosY - SubTransHeight);
  950.         MoveToEx(IGCurrenthDC,
  951.              SubTransPosX + SubTransWidth / 2, SubTransPosY, NULL);
  952.         LineTo(IGCurrenthDC,
  953.                SubTransPosX + SubTransWidth / 2,
  954.                SubTransPosY - SubTransHeight);
  955.         }
  956.     }
  957.  
  958.     for (i = 0; i < INTERACT_NUM_OF_STRINGS; i++) {
  959.         SetColorIndex2(InteractMenu.Strings[i].Color, 2);
  960.         SetTextColor(IGCurrenthDC, IGCrntColorHighIntensity);
  961.  
  962.         DrawTextLocal(InteractMenu.Strings[i].Str,
  963.           (int) (InteractMenu.Strings[i].X * TransWidth),
  964.           (int) ((1.0 - InteractMenu.Strings[i].Y) * TransHeight
  965.                         - SubTransHeight / 2));
  966.     }
  967.  
  968.     if (IGCurrenthPen)
  969.             DeleteObject(SelectObject(IGCurrenthDC, IGCurrenthPen));
  970.     EndPaint(hWnd, &ps);
  971.     IGCurrenthDC = 0;
  972.     IGCurrenthPen = 0;
  973.     }
  974. }
  975.  
  976. /*****************************************************************************
  977. * DESCRIPTION:                                                               *
  978. * Draw text centered at the given position.                     *
  979. *                                                                            *
  980. * PARAMETERS:                                                                *
  981. *   Str:         Text to draw.                                               *
  982. *   PosX, PosY:  And where to draw it.                                       *
  983. *                                                                            *
  984. * RETURN VALUE:                                                              *
  985. *   void                                                                     *
  986. *****************************************************************************/
  987. static void DrawTextLocal(char *Str, int PosX, int PosY)
  988. {
  989.     TextOut(IGCurrenthDC, PosX, PosY, Str, strlen(Str));
  990. }
  991.  
  992. /*****************************************************************************
  993. * DESCRIPTION:                                                               *
  994. * Sets the color/width according to the given color index/width.            *
  995. *                                                                            *
  996. * PARAMETERS:                                                                *
  997. *   color:     Index of color to use. Must be between 0 and IG_MAX_COLOR.    *
  998. *   width:     In pixel, for line draw.                                      *
  999. *                                                                            *
  1000. * RETURN VALUE:                                                              *
  1001. *   void                                                                     *
  1002. *****************************************************************************/
  1003. static void SetColorIndex2(int color, int width)
  1004. {
  1005.     if (color > IG_MAX_COLOR)
  1006.     color = IG_IRIT_WHITE;
  1007.  
  1008.     IGCrntColorHighIntensity = IGColorsHighIntensity[color];
  1009.     IGCrntColorLowIntensity = IGColorsLowIntensity[color];
  1010.  
  1011.     if (!IGCurrenthDC)
  1012.     return;
  1013.     if (IGCurrenthPen)
  1014.         DeleteObject(SelectObject(IGCurrenthDC, IGCurrenthPen));
  1015.     IGCurrenthPen = SelectObject(IGCurrenthDC, CreatePen(PS_SOLID, width,
  1016.                              IGCrntColorHighIntensity));
  1017.  
  1018.     IGGlblIntensityHighState = TRUE;
  1019. }
  1020.  
  1021. /*****************************************************************************
  1022. * DESCRIPTION:                                                               M
  1023. * Make some sound.                                                           M
  1024. *                                                                            *
  1025. * PARAMETERS:                                                                M
  1026. *   None                                                                     M
  1027. *                                                                            *
  1028. * RETURN VALUE:                                                              M
  1029. *   void                                                                     M
  1030. *                                                                            *
  1031. * KEYWORDS:                                                                  M
  1032. *   IGIritBeep                                                               M
  1033. *****************************************************************************/
  1034. void IGIritBeep(void)
  1035. {
  1036.     Beep(1000, 100);
  1037. }
  1038.  
  1039. /*****************************************************************************
  1040. * DESCRIPTION:                                                               M
  1041. *   Should we stop this animation?                                           M
  1042. *                                                                            *
  1043. * PARAMETERS:                                                                M
  1044. *   Anim:     The animation to abort.                                        M
  1045. *                                                                            *
  1046. * RETURN VALUE:                                                              M
  1047. *   int:      TRUE if we need to abort, FALSE otherwise.                     M
  1048. *                                                                            *
  1049. * KEYWORDS:                                                                  M
  1050. *   AnimCheckInterrupt                                                       M
  1051. *****************************************************************************/
  1052. int AnimCheckInterrupt(AnimationStruct *Anim)
  1053. {
  1054.     return FALSE;
  1055. }
  1056.